//
//  ICMCarModel.m
//  ICrEAM
//
//  Created by Cty on 2016/11/06.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ICMCarModel.h"

@implementation ICMCarModel
+(instancetype)creatDummyData{
    ICMCarModel *model = [[ICMCarModel alloc]init];
    //block1
    model.vinNum = @"LSVDL2931141731371";//车主姓名
    model.brand = @"大众";//品牌
    model.carKei = @"帕萨特";//车系
    model.carType = @"全新帕萨特330TSI至尊版";//车型
    model.isOurBranch = @"12781001";//本公司购车
    //block2
    model.carNum = @"沪K0234E";//车牌号
    model.useNature = @"非运营";//使用性质
    model.carNature = @"私家车";//车辆性质
    model.carUses = @"私家车";//车辆用途
    model.parchaseDate = @"2016-02-05";//购车发票日期
//    model.currentMillions = @"100000KM";//当前行驶里程
    model.lastMillions = @"100000KM";//当前行驶里程
    model.perMillions = @"10.23KM";//日均行驶里程

    
    //block3
    model.guaranteeEndDate = @"2018-02-12";//保修结束日期
    model.guaranteeEndMillions = @"200000KM";//保修结束里程
    model.nextCheckDate = @"2017-09-23";//下次验车时间
    
    //block4
    model.insuranceCompany = @"太平洋保险";//保险公司
    model.insuranceEndDate = @"2018-08-02";//保险日期结束


    return model;
}

+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper{
    return @{@"vinNum":@"VIN",
             @"brand":@"BRAND_CODE",
             @"brandName":@"BRAND_NAME",
             @"carKei":@"SERIES_CODE",
             @"carKeiName":@"SERIES_NAME",
             @"carType":@"MODEL_CODE",
             @"carTypeName":@"MODEL_NAME",
             @"isOurBranch":@"IS_SELF_COMPANY",
             @"carNum":@"LICENSE",
             @"useNature":@"USE_KIND",
             @"carNature":@"BUSINESS_KIND",
             @"carUses":@"VEHICLE_PURPOSE",
             //@"parchaseDate":@"INVOICE_DATE",
             @"parchaseDate":@"SALES_DATE",
             @"lastMillions":@"LAST_MAINTAIN_MILEAGE",
             @"currentMillions":@"MILEAGE",
             @"perMillions":@"DAILY_AVERAGE_MILEAGE",
             @"guaranteeEndDate":@"WRT_END_DATE",
             @"guaranteeEndMillions":@"WRT_END_MILEAGE",
             @"nextCheckDate":@"NEXT_INSPECT_DATE",
             @"insuranceCompany":@"INSURATION_NAME",
             @"insuranceEndDate":@"INSURANCE_END_DATE",
             @"adviserCode":@"SERVICE_ADVISOR",//专属服务顾问code
             @"adviserName":@"EMPLOYEE_NAME",//专属服务顾问name
             @"VEHICLE_LIFE_STATUS":@"VEHICLE_LIFE_STATUS",//专属服务顾问name
                @"OWNER_NO":@"OWNER_NO"
             };
}

- (void)setupCarModelWithCarInfoEditView:(ICMCarInfoEditView *)carInfoView WithOwnerInfoEditView:(ICMOwnerInfoEditView *)personerInfoView{
    //专属服务顾问
    self.adviserCode = personerInfoView.ownerServerView.noStr;
    
    //VIN
    self.vinNum = carInfoView.carVINView.contentText;
    //品牌
    self.brand = carInfoView.carBrandView.noStr;
    //车牌号
    self.carNum = carInfoView.carNumView.contentText;
    //购车发票日期
    self.parchaseDate = carInfoView.carInvoiceView.contentText;
    self.SALES_DATE = carInfoView.carInvoiceView.contentText;
    
    //车系
    self.carKei = carInfoView.carXiView.noStr;
    self.SERIES_CODE = carInfoView.carXiView.noStr;
    //车型
    self.carType = carInfoView.carTypeView.noStr;
    //使用性质
    NSString *useNature = [ICrEAMTool getDeatilCodeWithParameterDesc:carInfoView.carUsePropertyView.contentText withCode:ICMEnumIntToString(ICMEnumUseNaturePre)];
    self.useNature = useNature?useNature:@"0";
    //车辆性质
    NSString *carNature = [ICrEAMTool getDeatilCodeWithParameterDesc:carInfoView.carPropertyView.contentText withCode:ICMEnumIntToString(ICMEnumCarNaturePre)];
    self.carNature = carNature?carNature:@"0";
    
    //本公司购车
    self.isOurBranch = [carInfoView.carMyComBuyCarView.contentText isEqualToString:@"是"]?ICMEnumIntToString(ICMEnumYESOrNOYES):ICMEnumIntToString(ICMEnumYESOrNONO);
    //车辆用途
    NSString *carUses = [ICrEAMTool getDeatilCodeWithParameterDesc:carInfoView.carUseTypeView.contentText withCode:ICMEnumIntToString(ICMEnumCarUsesPre)];
    self.carUses = carUses?carUses:@"0";
    
    //保修结束日期
    self.guaranteeEndDate = carInfoView.carGuaranteeView.contentText;
    //保修结束里程
    self.guaranteeEndMillions = carInfoView.carKMView.contentText;
    //下次验车日期
    self.nextCheckDate = carInfoView.carNextTestView.contentText;
    
}

@end

